#encoding:utf-8

'''
data=2017/1/11 下午4:24
__author__='binpo',
author_email='binpocn@163.com',
'''

import tornado.web
import os
current_path = os.path.dirname(__file__)
static_path = os.path.join(current_path,'static')
template_path = os.path.join(current_path,'templates')
import sys
# reload(sys)
# sys.setdefaultencoding('utf8')
settings = dict(
    title=u"edc manager",
    desc=u"edc manager",
    static_path=static_path,
    template_path=template_path,
    cookie_secret='^e9060bd3a5987d638ac66399444117d1',
    login_url='/login.html',
    xsrf_cookies=False,
    debug=True,
)

class Application(tornado.web.Application):

    def __init__(self, handlers,**settings):
        tornado.web.Application.__init__(self, handlers, **settings)

from tornado.web import url
from handlers import *
from coin_handlers import *#,CoinDownloadHandler
handlers=[
    url(r"/convert.html", ExchangeConvertHandler, name="convert"),
    url(r"/transfer.html", TransferHandler, name="transfer"),
    url(r"/task/list.html", TransferListHandler, name="tasks"),
    url(r"/exchange/list.html", ExchangeListHandler, name="tasks"),
   
    url(r"/echat/coin/list.html", CoinDownloadHandler, name="coin_list"),
    url(r"/echat/coin/download.html", CoinDownloadHandler, name="coin_download"),
    url(r"/echat/coin/upload.html", CoinUploadHandler, name="coin_upload"),
    
]
if __name__ == "__main__":
    try:
        port = int(sys.argv[1])
    except:
        port = 8000
    app = Application(handlers,**settings)
    app.listen(port)
    print ("Starting development server:"+str(port))
    http_server = tornado.httpserver.HTTPServer(app, xheaders=True)
    tornado.ioloop.IOLoop.instance().start()